package com.example.mylazyviewpager;

import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

public class SimpleFragment extends Fragment {
    private final String TAG = "SimpleFragment";
    private int index = -1;
    public SimpleFragment(int index) {
        this.index = index;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        Log.e(TAG, "onCreateView: " + index);
        return inflater.inflate(R.layout.simple_fragment, container, false);
    }

    @Override
    public void setUserVisibleHint(boolean isVisibleToUser) {
        super.setUserVisibleHint(isVisibleToUser);
        Log.e(TAG, "setUserVisibleHint: isVisibleToUser " + isVisibleToUser +" "+index);
    }

    protected  void  onFragmentStopLoad(){
        Log.e(TAG, "onFragmentStopLoad: ");
    }

    protected  void onFragmentLoad(){
        Log.e(TAG, "onFragmentLoad: ");
    }


    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.e(TAG, "onCreate: " + index);
    }

    @Override
    public void onResume() {
        super.onResume();
        Log.e(TAG, "onResume: " + index);
    }

    @Override
    public void onPause() {
        super.onPause();
        Log.e(TAG, "onPause: " + index);
    }

    @Override
    public void onStop() {
        super.onStop();
        Log.e(TAG, "onStop: " + index);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        Log.e(TAG, "onDestroy: " + index);
    }

    @Override
    public void onStart() {
        super.onStart();
        Log.e(TAG, "onStart: " + index);
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        Log.e(TAG, "onAttach: " + index);
    }

    @Override
    public void onAttachFragment(Fragment childFragment) {
        super.onAttachFragment(childFragment);
        Log.e(TAG, "onAttachFragment: " + index);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        Log.e(TAG, "onActivityCreated: " + index);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        Log.e(TAG, "onDestroyView: " + index);
    }

    @Override
    public void onDetach() {
        super.onDetach();
        Log.e(TAG, "onDetach: " + index);
    }


}
